--[[/**
-- * 
 *	获得生命时, 转换掉
-- *
-- */]]

---@class BuffEffect615103 : BaseBuffEffect
BuffEffect615103 = ClientFight.CreateClass("BuffEffect615103", ClientFight.BaseBuffEffect)
local t = BuffEffect615103

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    if (table.getn(parameters) < 3) then
        return IBuffEffect.FAIL;
    end
    if (not parameters[3]) then
        return IBuffEffect.FAIL;
    end
    local result = parameters[3];
    local damage = result.damage;
    if (not result:isDamage()) then
        return IBuffEffect.FAIL;
    end
    local addValue = Utils.calcRatio(result.damage, buff.buffBean.f_BuffEffectValue[1]);
    result.damage = result.damage - addValue;
    if (result.damage < 0) then
        result.damage = 0;
    end
    local old = buff.target.parametersByObject[BuffEffect615102.BuffEffect615102_HIDE_HP] or 0;
    if (addValue > 0) then
        buff.target.parametersByObject[BuffEffect615102.BuffEffect615102_HIDE_HP] = old + addValue;
    end
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff:"
            .. buff.modelId .. " 被治疗时: " .. damage .. " 转换成隐藏的血量: " .. addValue .. "  总存储的隐藏血量:" .. (old + addValue));
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()